/**
 * 抽象类
 */
export {}

// 抽象类只允许被继承，不允许实例化
abstract class Animal {
  eat (food: string) {
    console.log(`呼噜呼噜的吃: ${food}`)
  }

  // 抽象方法，需要在子类被实现
  abstract run (distance: number): void
}

class Dog extends Animal {
  run(distance: number): void {
    console.log(`爬行: ${distance}`)
  }
}

const d = new Dog()
d.eat('骨头')
d.run(100)
